package ooday05;
/** static的测试类 */
public class StaticDemo {
    public static void main(String[] args) {

        StaticVar o1 = new StaticVar();
        o1.show();//a=1,b=1

        StaticVar o2 = new StaticVar();
        o2.show();//a=1,b=2

        StaticVar o3 = new StaticVar();
        o3.show();//a=1,b=3
        System.out.println(StaticVar.b);//访问静态变量

        StaticBlock o4 = new StaticBlock();//静态块在加载类时自动执行，且只执行一次
        StaticBlock o5 = new StaticBlock();
        StaticBlock o6 = new StaticBlock();

    }
}
